﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DingTalkAgent.Model
{
    public class T_Customer
    {
        public int id { get; set; }
        /// <summary>
        /// 客户名
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 联系方式
        /// </summary>
        public string telephone { get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        public string address { get; set; }
        /// <summary>
        /// 来源（什么渠道知道我们）
        /// </summary>
        public int source { get; set; }

        public string sourceText
        {
            get
            {
                if (source == 0)
                    return "未知";
                else if (source == 1)
                    return "网络";
                else if (source == 2)
                    return "宣传册";
                else if (source == 3)
                    return "病友推荐";
                else if (source == 4)
                    return "医院推荐";
                return "未知";
            }
        }
        /// <summary>
        /// 意向服务结构、内容
        /// </summary>
        public string intentService { get; set; }
        /// <summary>
        /// 销售
        /// </summary>
        public int saleUserId { get; set; }
        public string saleUser { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public string createUser { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime createDt { get; set; }
    }

    public class T_CustomerDTO: PageInfo
    {
        public List<T_Customer> rows { get; set; }
    }

    public class PageInfo
    {
        public int page { get; set; }
        public int pageSize { get; set; }
        public int total
        {
            get
            {
                if (pageSize > 0)
                {
                    return (int)Math.Ceiling((decimal)records / pageSize);
                }
                else
                {
                    return 0;
                }
            }
        }
        public int records { get; set; }
    }

}
